<?php

require 'conn.php';

require 'config.php';

if ($site_soc==1){

	$str="";

	$str.="function QQ(){\n";

	$str.="var Div=document.createElement('div');\n";

	$str.="Div.id='qq_online';\n";

	$str.="Div.style.position='absolute';\n";

	$str.="Div.style.top='{$site_soc_top}px';\n";

	$str.="var Html='';\n";

	if ($site_soc_style==0){

		$str.="Div.style.{$site_soc_dir}='{$site_soc_lr}px';\n";

		$str.="Html+='<div id=\"qq_online_top\"><img src=\"images/qq_style/style0_close.gif\" onclick=\"$2(\'qq_online\').style.display=\'none\';\" title=\"关闭\" />Online Service</div>';\n";

		$str.="Html+='<div id=\"qq_online_list\">';\n";

		$query=mysql_query('select * from '.$language.'_online_service order by o_order,o_id');

		if (mysql_num_rows($query)>0){

		while($row=mysql_fetch_array($query)){

			switch($row['o_class']){

			case 1:

				$str.="Html+='<p><img src=\"images/qq.png\"><a href=\"http://wpa.qq.com/msgrd?v=3&uin={$row['o_number']}&site={$row['o_name']}&menu=yes\" target=\"_blank\">{$row['o_name']}</a></p>';\n";

				break;

			case 2:

				$str.="Html+='<p><img src=\"images/msn.png\" /><a href=\"msnim:chat?contact={$row['o_number']}\" target=\"_blank\">{$row['o_name']}</a></p>';\n";

				break;

			case 3:

				$str.="Html+='<p><img src=\"images/skype.png\" /><a href=\"skype:{$row['o_number']}?chat\" target=\"_blank\">{$row['o_name']}</a></p>';\n";

				break;

			case 4:

				$str.="Html+='<p><img src=\"images/wang.png\" /><a href=\"http://amos.im.alisoft.com/msg.aw?v=2&uid={$row['o_number']}&site=cnalichn&s=4\" target=\"_blank\">{$row['o_name']}</a></p>';\n";

				break;

			case 5:

				$str.="Html+='<p><img src=\"images/wang.png\" /><a href=\"http://amos.im.alisoft.com/msg.aw?v=2&uid={$row['o_number']}&site=cntaobao&s=4\" target=\"_blank\">{$row['o_name']}</a></p>';\n";

				break;

			}

		}

		}

		$str.="Html+='</div>';\n";

		$str.="Html+='<p id=\"qq_online_bottom\"></p>';\n";

	}

	else {

		if ($site_soc_default==1){

			$str.="Div.style.{$site_soc_dir}='{$site_soc_lr}px';\n";

		}

		else {

			$str.="Div.style.{$site_soc_dir}='-130px';\n";

		}

		$str.="Div.className='qq_onlines_{$site_soc_style}';\n";

		$str.="Html+='<div id=\"qq_onlines_top\">在 线 咨 询<p class=\"qq_onlines_small_{$site_soc_dir}\" onclick=\"QQ_Close();\"><strong>在线咨询</strong></p></div>';\n";

		$str.="Html+='<div id=\"qq_onlines_box\">';\n";

		if ($site_soc_tel==1 && $site_tel!='') $str.="Html+='<p id=\"qq_onlines_tel\">服务热线<strong>{$site_tel}</strong></p>';\n";

		$str.="Html+='<p id=\"qq_onlines_list\">';\n";

		$query=mysql_query('select * from '.$language.'_online_service order by o_order,o_id');

		if (mysql_num_rows($query)>0){

		while($row=mysql_fetch_array($query)){

			switch($row['o_class']){

			case 1:

				$str.="Html+='<a href=\"http://wpa.qq.com/msgrd?v=3&uin={$row['o_number']}&site={$row['o_name']}&menu=yes\" target=\"_blank\"><img src=\"images/qq.png\">{$row['o_name']}</a>';\n";

				break;

			case 2:

				$str.="Html+='<a href=\"msnim:chat?contact={$row['o_number']}\" target=\"_blank\"><img src=\"images/msn.png\" />{$row['o_name']}</a>';\n";

				break;

			case 3:

				$str.="Html+='<a href=\"skype:{$row['o_number']}?chat\" target=\"_blank\"><img src=\"images/skype.png\" />{$row['o_name']}</a>';\n";

				break;

			case 4:

				$str.="Html+='<a href=\"http://amos.im.alisoft.com/msg.aw?v=2&uid={$row['o_number']}&site=cnalichn&s=4\" target=\"_blank\"><img src=\"images/wang.png\" />{$row['o_name']}</a>';\n";

				break;

			case 5:

				$str.="Html+='<a href=\"http://amos.im.alisoft.com/msg.aw?v=2&uid={$row['o_number']}&site=cntaobao&s=4\" target=\"_blank\"><img src=\"images/wang.png\" />{$row['o_name']}</a>';\n";

				break;

			}

		}

		}

		$str.="Html+='</p>';\n";

		if ($site_soc_tdc==1 && $site_tdc!='') $str.="Html+='<p id=\"qq_onlines_tdc\"><img src=\"{$site_tdc}\" /></p>';\n";

		$str.="Html+='</div>';\n";

	}

	$str.="Div.innerHTML=Html;\n";

	$str.="document.body.appendChild(Div);\n";

	$str.="FloatDiv('qq_online',{$site_soc_top});\n";

	$str.="}\n";

	$str.="if (document.all){\n";

	$str.="window.attachEvent('onload',QQ)\n";

	$str.="}else{\n";

	$str.="window.addEventListener('load',QQ,false);\n";

	$str.="}";

	$str.="function QQ_Close(){\n";

	$str.="if($('#qq_online').css('{$site_soc_dir}')=='-130px'){\n";

	$str.="$('#qq_online').animate({{$site_soc_dir}:'0px'},300);\n";

	$str.="}\n";

	$str.="else {\n";

	$str.="$('#qq_online').animate({{$site_soc_dir}:'-130px'},300);\n";

	$str.="}\n";

	$str.="}\n";

	echo $str;

}

?>

